﻿///***************************************************************
/// 시  스  템 : Updms.Car
/// 단위시스템 : CAR
/// 계      층 : Presentation Layer
/// 프로그램명 : Car1011m
/// 파  일  명 : Car1011m.aspx.cs
/// 설      명 : 주유관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-20 송시명   최초 작성
///***************************************************************
using System;
using System.Data;
using System.Collections;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using SMFramework.Data;
using SMFramework.Utility;
using SMFramework.Web.UI.WebControls.Page;

using Base.AppFramework.Web.UI.CommandBar;
using Base.Dac;
using Updms.Car.Exe;


namespace Updms.Car
{
	public partial class Car1011m : Updms.Common.BaseClass.PageBase
	{
		#region 전역영역

		//프로그램상수
		public static readonly string PID = "Car1011m";
		public static readonly string gs_path_info = "/updms/Car/" + PID + ".aspx";

		Global global = new Global();
		AccessCheck access = new AccessCheck();

		//페이징
		private int li_cur_page, li_row_count, li_st_page, li_ed_page;
		protected int li_page_size = GRID_PAGESIZE;// 한 페이지에 출력될 행의수

		//검색
		protected string kw1 = "";	// 차량ID
		protected string kw2 = "";	// 주유일(부터)
		protected string kw3 = "";	// 주유일(까지)
		protected string kw4 = "";	// 주유소

		//메뉴 선택값
		protected string gs_sm = "";

		//페이지별합계
		decimal ld_amount = 0;		//주유금액
		decimal ld_quantity = 0;	//주유량
		decimal ld_distance = 0;	//누적주행거리(최근 - 이전)

		//페이지모드
		private string gs_page_mode = "";	// 팝업으로 열지 여부
		private string gs_refuelling_dt = "";	//주유일
		private string gs_amount = "";	//주유금액
		private string gs_station = "";	//주유소

		#endregion

		#region Page_Load, OnPageLoad

		protected void Page_Load(object sender, EventArgs e)
		{
			SetInit();
			if (!Page.IsPostBack)
			{
				// 최초 화면 로딩시 처리해야 할 부분
				OnPageLoad();
				SearchProcess();
				SetLastAmountPerLiter();
			}
		}

		// OnPageLoad
		private void OnPageLoad()
		{
			SetLiterals(global.GetLabelInfoByPgmId(PID, LANG_SET));
			SetClientScript();
			SetCarInfoList();
			SetStationId();
			SetCarInfo();
			SetSearchParameter();
		}

		#endregion

		#region InitializeComponent

		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
			this.PreRender += new System.EventHandler(this.Page_PreRender);
		}

		#endregion

		#region SetClientScript

		private void SetClientScript()
		{
			//onKeyUp이벤트
			txt_amount_per_liter.Attributes.Add("onkeyup", "document.form1.txt_amount_per_liter.value=addComma(document.form1.txt_amount_per_liter.value);");
			txt_amount.Attributes.Add("onkeyup", "document.form1.txt_amount.value=addComma(document.form1.txt_amount.value);");
			txt_distance.Attributes.Add("onkeyup", "document.form1.txt_distance.value=addComma(document.form1.txt_distance.value);");

			//엔터검색
			txt_search_refuelling_dt_from.Attributes.Add("onkeypress", "enterSearchOnPage(event)");
			txt_search_refuelling_dt_to.Attributes.Add("onkeypress", "enterSearchOnPage(event)");
			
			//달력콘트롤 설정
			ce_refuelling_dt.SelectedDate = string.IsNullOrEmpty(gs_refuelling_dt) ? DateTime.Now.AddDays(0) : Convert.ToDateTime(gs_refuelling_dt);
		}

		#endregion

		#region SetInit, SetSearchParameter, ShowKeywordLabel

		//초기값설정
		private void SetInit()
		{
			lbl_search_flag.Text = "INIT";
			if (Request.QueryString["page"] == null || int.Parse(Request.QueryString["page"]) == 1)
			{
				li_cur_page = 1;
				li_st_page = 0;
				li_ed_page = li_page_size;
			}
			else
			{
				li_cur_page = int.Parse(Request.QueryString["page"]);
				li_st_page = (int.Parse(Request.QueryString["page"]) - 1) * li_page_size;
				li_ed_page = li_st_page + li_page_size;
			}

			gs_sm = (Request.QueryString["sm"] == null || Request.QueryString["sm"].Trim().Length != 7)
					? global.GetDirDepth(PID) : Request.QueryString["sm"].ToString();

			gs_page_mode = string.IsNullOrEmpty(Request.QueryString["page_mode"]) ? "" : Request.QueryString["page_mode"].ToString();
			gs_refuelling_dt = string.IsNullOrEmpty(Request.QueryString["refuelling_dt"]) ? "" : Request.QueryString["refuelling_dt"].ToString();
			gs_amount = string.IsNullOrEmpty(Request.QueryString["amount"])	? "" : Request.QueryString["amount"].ToString();
			gs_station = string.IsNullOrEmpty(Request.QueryString["station"]) ? "" : Request.QueryString["station"].ToString();
		}

		//검색파라미터
		private void SetSearchParameter()
		{
			switch (lbl_search_flag.Text.Trim().ToUpper())
			{
				case "INIT":
					if (String.IsNullOrEmpty(Request.QueryString["kw1"]))	// url에 값이 없으면
					{
						kw1 = ddl_search_car_id.SelectedValue;
					}
					else
					{
						kw1 = Server.UrlDecode(Request.QueryString["kw1"]);
						ddl_search_car_id.SelectedValue = kw1;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw2"]))	// url에 값이 없으면
					{
						if (String.IsNullOrEmpty(txt_search_refuelling_dt_from.Text))
						{
							kw2 = DateUtil.GetMonthEx(-12);	// 오늘부터 12개월전
							txt_search_refuelling_dt_from.Text = kw2;
						}
						else
						{
							kw2 = txt_search_refuelling_dt_from.Text.Trim();
						}
					}
					else
					{
						kw2 = Server.UrlDecode(Request.QueryString["kw2"]);
						txt_search_refuelling_dt_from.Text = kw2;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw3"]))	// url에 값이 없으면
					{
						if (String.IsNullOrEmpty(txt_search_refuelling_dt_to.Text))
						{
							kw3 = DateUtil.GetMonthEx(0);	// 오늘
							txt_search_refuelling_dt_to.Text = kw3;
						}
						else
						{
							kw3 = txt_search_refuelling_dt_to.Text.Trim();
						}
					}
					else
					{
						kw3 = Server.UrlDecode(Request.QueryString["kw3"]);
						txt_search_refuelling_dt_to.Text = kw3;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw4"]))	// url에 값이 없으면
					{
						kw4 = ddl_search_station_id.SelectedValue;
					}
					else
					{
						kw4 = Server.UrlDecode(Request.QueryString["kw4"]);
						ddl_search_station_id.SelectedValue = kw4;
					}
					
					break;
				case "SEARCH":
					kw1 = ddl_search_car_id.SelectedValue;
					kw2 = String.IsNullOrEmpty(txt_search_refuelling_dt_from.Text) ? DateUtil.GetMonthEx(-12) : txt_search_refuelling_dt_from.Text.Trim();
					kw3 = String.IsNullOrEmpty(txt_search_refuelling_dt_to.Text) ? DateUtil.GetMonthEx(0) : txt_search_refuelling_dt_to.Text.Trim();
					kw4 = ddl_search_station_id.SelectedValue;
					break;
			}
		}

		//검색키워드
		private void ShowKeywordLabel()
		{
			string ls_kw1 = ddl_search_car_id.SelectedItem.Text;
			string ls_kw4 = ConversionUtil.CompareReplace(ddl_search_station_id.SelectedItem.Text, DDL_SELECT, "-");
			lbl_search_keyword.Text = ls_kw1 + " / " + kw2 + " ~ " + kw3 + " / " + ls_kw4;
		}

		#endregion

		#region 마스터 Method (SetCarInfoList, SetCarInfo, SetStationId)

		//차량목록
		private void SetCarInfoList()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();
			Car1010m_NT _Car1010m_NT = new Car1010m_NT();

			lo_dp.AddProperty("ls_use_yn", typeof(string), "Y");	//사용여부가 Y인것만

			lo_ds.Merge(_Car1010m_NT.GetCarInfoList(lo_dp));

			ddl_search_car_id.Items.Clear();
			ddl_search_car_id.DataSource = lo_ds;
			ddl_search_car_id.DataMember = "UPDMS_CAR_INFO";
			ddl_search_car_id.DataTextField = "Text";
			ddl_search_car_id.DataValueField = "Value";
			ddl_search_car_id.DataBind();
		}

		//차량사진
		private void SetCarInfo()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("ls_car_id", typeof(string), ddl_search_car_id.SelectedValue);

			using(Car1010m_NT _Car1010m_NT = new Car1010m_NT())
			{
				lo_ds.Merge(_Car1010m_NT.GetCarInfo(lo_dp));
			}

			string ls_car_image = DataSetUtil.GetFldStr(lo_ds, "UPDMS_CAR_INFO", "Attach_File1");
			img_car_image.Src = FILE_PATH_UPLOAD_WEB_PATH + (string.IsNullOrEmpty(ls_car_image) ? "empty.png" : ls_car_image);
		}

		private void SetStationId()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();
			Car1013m_NT _Car1013m_NT = new Car1013m_NT();

			lo_dp.AddProperty("ls_div", typeof(string), "AF001");		//주유소
			lo_dp.AddProperty("ls_use_yn", typeof(string), "Y");	//사용여부가 Y인것만
			lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);

			lo_ds.Merge(_Car1013m_NT.GetStationListByDiv(lo_dp));

			ddl_search_station_id.Items.Clear();
			ddl_search_station_id.DataSource = lo_ds;
			ddl_search_station_id.DataMember = "UPDMS_CAR_STATION";
			ddl_search_station_id.DataTextField = "Station_Nm";
			ddl_search_station_id.DataValueField = "Station_Id";
			ddl_search_station_id.DataBind();
			ddl_search_station_id.Items.Insert(0, new ListItem(DDL_SELECT, ""));
			

			ddl_station_id.Items.Clear();
			ddl_station_id.DataSource = lo_ds;
			ddl_station_id.DataMember = "UPDMS_CAR_STATION";
			ddl_station_id.DataTextField = "Station_Nm";
			ddl_station_id.DataValueField = "Station_Id";
			ddl_station_id.DataBind();
		}

		#endregion

		#region 디테일 Method (SetLastAmountPerLiter)

		//리터당가격
		private void SetLastAmountPerLiter()
		{
			Car1011m_NT _Car1011m_NT = new Car1011m_NT();

			string ls_last_amount_per_liter = _Car1011m_NT.GetLastAmountPerLiter();

			txt_amount_per_liter.Text = ConversionUtil.AddComma(ls_last_amount_per_liter);
		}

		#endregion

		#region CRUD (SelectProcess, InsertProcess, UpdateProcess, DeleteProcess, SearchProcess)

		//조회
		private void SelectProcess()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();
			int li_page_count;

			//검색
			lo_dp.AddProperty("ls_car_id", typeof(string), kw1);
			lo_dp.AddProperty("ls_refuelling_dt_from", typeof(string), kw2);
			lo_dp.AddProperty("ls_refuelling_dt_to", typeof(string), kw3);
			lo_dp.AddProperty("ls_filling_station", typeof(string), kw4);

			using (Car1011m_NT _Car1011m_NT = new Car1011m_NT())
			{
				li_row_count = _Car1011m_NT.GetSearchCount(lo_dp);	// 검색된 행수
				li_page_count = (int)((li_row_count - 1) / li_page_size) + 1;	// 총페이지수 계산

				//모두보기/페이징
				lo_dp.AddProperty("li_st_page", typeof(Int32), (cb_list_all.Checked) ? 0 : li_st_page);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), (cb_list_all.Checked) ? li_row_count : li_ed_page);
				lbl_page.Visible = !cb_list_all.Checked;

				lo_ds.Merge(_Car1011m_NT.SelectProcess(lo_dp));
			}

			GridView1.DataSource = lo_ds;
			GridView1.DataBind();

			Pager pager = new Pager(this, ref lbl_page);
			pager.PageNavigation(
				li_cur_page,
				li_page_count,
				gs_path_info + "?sm=" + gs_sm + "&kw1=" + Server.UrlEncode(kw1) + "&kw2=" + Server.UrlEncode(kw2) + "&kw3=" + Server.UrlEncode(kw3) + "&kw4=" + Server.UrlEncode(kw4) + "&page_mode=" + gs_page_mode + "&refuelling_dt=" + gs_refuelling_dt + "&page=");

			//결과출력(키워드, 검색행수)
			ShowKeywordLabel();
			lbl_result_count.Text = li_row_count.ToString("#,###,##0");
		}

		//저장
		private void InsertProcess()
		{
			using (Car1011m_RT _Car1011m_RT = new Car1011m_RT())
			{
				int li_return = _Car1011m_RT.InsertProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_007" : "MSG_ERR_105";	//저장되었습니다:저장할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//수정
		private void UpdateProcess()
		{
			using (Car1011m_RT _Car1011m_RT = new Car1011m_RT())
			{
				int li_return = _Car1011m_RT.UpdateProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_006" : "MSG_ERR_104";	//수정되었습니다:수정할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//삭제
		private void DeleteProcess(string ls_xml)
		{
			using (Car1011m_RT _Car1011m_RT = new Car1011m_RT())
			{
				int li_return = _Car1011m_RT.DeleteProcess(ls_xml);
				string ls_msg_id = (li_return > 0) ? "MSG_INF_004" : "MSG_ERR_103";	//삭제되었습니다:삭제할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//검색
		private void SearchProcess()
		{
			lbl_search_flag.Text = "SEARCH";
			SetSearchParameter();
			ClearValue();
			SelectProcess();
		}

		#endregion

		#region SetValue, ClearValue

		//SetValue
		private DataPack SetValue()
		{
			DataPack lo_dp = new DataPack();
			
			lo_dp.AddProperty("Seq",				typeof(string),		lbl_pk.Text);
			lo_dp.AddProperty("Car_Id",				typeof(string), 	ddl_search_car_id.SelectedValue);
			lo_dp.AddProperty("Refuelling_Dt",		typeof(string), 	ConversionUtil.DefaultValue(txt_refuelling_dt.Text));
			lo_dp.AddProperty("Station_Id",			typeof(string), 	ddl_station_id.SelectedValue);
			lo_dp.AddProperty("Amount_Per_Liter",	typeof(string), 	ConversionUtil.ExtractNumberStr(ConversionUtil.DefaultValue(txt_amount_per_liter.Text,"0")));
			lo_dp.AddProperty("Amount",				typeof(string), 	ConversionUtil.ExtractNumberStr(ConversionUtil.DefaultValue(txt_amount.Text,"0")));
			lo_dp.AddProperty("Quantity",			typeof(decimal),	Convert.ToDecimal(txt_quantity.Text));
			lo_dp.AddProperty("Distance",			typeof(string), 	ConversionUtil.ExtractNumberStr(ConversionUtil.DefaultValue(txt_distance.Text,"0")));
			lo_dp.AddProperty("Remark",				typeof(string), 	ConversionUtil.DefaultValue(txt_remark.Text));
			lo_dp.AddProperty("Create_User",		typeof(string), 	USER_ID);
			lo_dp.AddProperty("Create_Dt",			typeof(string), 	"");
			lo_dp.AddProperty("Update_User",		typeof(string), 	USER_ID);
			lo_dp.AddProperty("Update_Dt",			typeof(string), 	"");

			return lo_dp;
		}

		//ClearValue
		private void ClearValue()
		{
			lbl_pk.Text					= "";
			h_no.Value					= "";
			ce_refuelling_dt.SelectedDate = DateTime.Now.AddDays(0);
			ddl_station_id.SelectedIndex = 0;
			txt_amount_per_liter.Text	= "";
			txt_amount.Text				= "";
			txt_quantity.Text			= "";
			txt_distance.Text			= "";
			txt_remark.Text				= "";
		}

		#endregion

		#region Page_PreRender, ChangePageMode

		// Page_PreRender
		private void Page_PreRender(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				//접근권한 체크
				if (!access.CheckPgmAccessGrant(PID, USER_ID, ACCESS_LOG_INFO))
				{
					Response.Redirect(URL_NO_AUTHORITY_REDIRECT_BASE);	//사용자의 권한은 요청하신 페이지를 볼 수 없습니다
				}
				//사용권한별 버튼처리
				PagePreRender.SetVisibleCtrl(this, access.CheckPgmUsingGrant(USER_DIV, PID), access.GetVisibleCtrl(PID));
			}
			ChangePageMode();

			//페이지모드 처리
			string ls_class = String.IsNullOrEmpty(lbl_pk.Text) ? "sbtn sbtn_mode_i" : "sbtn sbtn_mode_u";
			string ls_title = String.IsNullOrEmpty(lbl_pk.Text) ? "입력" : "수정";
			btn_chg_mode.Attributes.Add("class", ls_class);
			btn_chg_mode.Attributes.Add("title", ls_title);
		}

		//ChangePageMode
		private void ChangePageMode()
		{
			switch (gs_page_mode)
			{
				case "":		// 처음 페이지로드시
					Top.Visible = true;
					menu_area.Attributes.Add("class", "");
					ibtn_delete.Visible = access.CheckPgmUsingGrant(USER_DIV, PID);
					ibtn_close.Visible = false;
					break;
				case "P":	// 팝업으로 열때
					Top.Visible = false;
					menu_area.Attributes.Add("class", "nodisplay");
					ce_refuelling_dt.SelectedDate = Convert.ToDateTime(gs_refuelling_dt);
					txt_amount.Text = gs_amount;

					if (WebControlUtil.CheckDdlText(ddl_station_id, gs_station))
					{
						ddl_station_id.SelectedValue = WebControlUtil.GetDdlValueByText(ddl_station_id, gs_station);
					}

					ibtn_delete.Visible = false;
					ibtn_close.Visible = true;
					break;
			}
			SetGridViewHeader(global.GetColumnListByPgmId(PID, LANG_SET));
		}

		#endregion
		
		#region GridView이벤트

		//RowDataBound
		protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
		{
			if (e.Row.RowType == DataControlRowType.DataRow)
			{
				//마우스올렸을 때
				e.Row.Attributes.Add("onmouseover", "overBackground('GridView1', " + (e.Row.RowIndex + 1) + ")");
				e.Row.Attributes.Add("onmouseout", "outBackground('GridView1', 1)");

				//번호
				e.Row.Cells[1].Text	= cb_list_all.Checked
					? (li_row_count - e.Row.RowIndex).ToString() 
					: ((li_row_count - ((li_cur_page - 1) * li_page_size)) - e.Row.RowIndex).ToString();

				//페이지별 합계
				ld_amount += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Amount"));
				ld_quantity += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Quantity"));
			}

			//Footer에 합계 바인딩
			if (e.Row.RowType == DataControlRowType.Footer)
			{
				//주행거리 = 누적주행거리(최근 - 최초)
				decimal ld_max = Convert.ToDecimal(GridView1.Rows[0].Cells[12].Text);
				decimal ld_min = Convert.ToDecimal(GridView1.Rows[GridView1.Rows.Count - 1].Cells[12].Text);
				ld_distance = ld_max - ld_min;
				
				e.Row.Cells[0].Text = "Total";
				e.Row.Cells[0].Attributes.Add("class", "total");
				e.Row.Cells[0].ColumnSpan = 7;
				e.Row.Cells[1].Visible = false;
				e.Row.Cells[2].Visible = false;
				e.Row.Cells[3].Visible = false;
				e.Row.Cells[4].Visible = false;
				e.Row.Cells[5].Visible = false;
				e.Row.Cells[6].Visible = false;
				e.Row.Cells[7].Visible = false;
				e.Row.Cells[8].Visible = false;
				e.Row.Cells[9].Visible = false;
				e.Row.Cells[10].Text = ld_amount.ToString("#,###,##0");
				e.Row.Cells[10].Attributes.Add("class", "money");
				e.Row.Cells[11].Text = ld_quantity.ToString("#,###,##0.#0");
				e.Row.Cells[11].Attributes.Add("class", "money");
				e.Row.Cells[12].Text = ld_distance.ToString("#,###,##0");
				e.Row.Cells[12].Attributes.Add("class", "money");
				e.Row.Cells[13].Visible = false;
			}
		}

		//RowCommand
		protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			GridView gv = (GridView)sender;
			GridViewRow row = (GridViewRow)(((Control)e.CommandSource).NamingContainer);

			LinkButton lbtn_rc = (LinkButton)GridView1.Rows[row.RowIndex].FindControl("lbtn_rc");

			//row.Cells[0].Text.ToString();//0.체크박스
			h_no.Value						= row.Cells[1].Text.ToString();									//1.번호
			lbl_pk.Text						= gv.DataKeys[row.RowIndex].Values["Seq"].ToString();			//2.Seq
			ddl_search_car_id.SelectedValue	= gv.DataKeys[row.RowIndex].Values["Car_Id"].ToString();		//3.Car_Id
																											//4.Car_Nm
			txt_refuelling_dt.Text			= lbtn_rc.Text;													//5.Refuelling_Dt (template)
			ddl_station_id.SelectedValue	= gv.DataKeys[row.RowIndex].Values["Station_Id"].ToString();	//6.Station_Id
																											//7.Station_Nm
																											//8.Whereis_Url_Link
			txt_amount_per_liter.Text		= row.Cells[9].Text.Trim();										//9.Amount_Per_Liter
			txt_amount.Text					= row.Cells[10].Text.Trim();									//10.Amount
			txt_quantity.Text				= row.Cells[11].Text.Trim();									//11.Quantity
			txt_distance.Text				= row.Cells[12].Text.Trim();									//12.Distance
			txt_remark.Text					= gv.DataKeys[row.RowIndex].Values["Remark"].ToString();		//13.Remark

			//팝업에서는 신규모드로 전환(수정은 없다)
			if (gs_page_mode == "P")
			{
				h_no.Value = "";
				lbl_pk.Text = "";
			}
		}

		#endregion

		#region 버튼이벤트

		//검색
		protected void ibtn_search_Click(object sender, EventArgs e)
		{
			SearchProcess();
		}

		//저장
		protected void ibtn_save_Click(object sender, EventArgs e)
		{
			if (global.CheckSaveMode("UPDMS_CAR_REFUELLING", "Seq", lbl_pk.Text.Trim()))
			{
				UpdateProcess();
			}
			else
			{
				InsertProcess();
			}
		}

		//삭제
		protected void ibtn_delete_Click(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder();

			sb.Append("<UPDMS>");

			for (int i = 0; i < GridView1.Rows.Count; i++)
			{
				GridViewRow row = GridView1.Rows[i];
				HtmlInputCheckBox cb = (HtmlInputCheckBox)row.FindControl("cb_check");

				if (cb.Checked)
				{
					string ls_seq = GridView1.DataKeys[i].Values["Seq"].ToString();
					sb.Append("<UPDMS_CAR_REFUELLING>");
					sb.Append("<Seq>" + ls_seq + "</Seq>");
					sb.Append("</UPDMS_CAR_REFUELLING>");
				}
			}
			sb.Append("</UPDMS>");

			DeleteProcess(sb.ToString());
		}

		//엑셀
		protected void ibtn_excel_Click(object sender, EventArgs e)
		{
			SetSearchParameter();

			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("ls_car_id", typeof(string), kw1);
			lo_dp.AddProperty("ls_refuelling_dt_from", typeof(string), kw2);
			lo_dp.AddProperty("ls_refuelling_dt_to", typeof(string), kw3);
			lo_dp.AddProperty("ls_filling_station", typeof(string), kw4);

			using (Car1011m_NT _Car1011m_NT = new Car1011m_NT())
			{
				li_row_count = _Car1011m_NT.GetSearchCount(lo_dp);

				lo_dp.AddProperty("li_st_page", typeof(Int32), 0);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), li_row_count);

				lo_ds.Merge(_Car1011m_NT.SelectProcess(lo_dp));
			}
			string fileName = PID + "(" + global.GetMenuTitle(PID, LANG_SET) + ")";
			ExcelUtil.CreateExcelFileX(this.Page, fileName, lo_ds, SetExcelHeaderX(global.GetColumnListByPgmId(PID, LANG_SET)));
		}

		//모두보기
		protected void cb_list_all_CheckedChanged(object sender, EventArgs e)
		{
			SearchProcess();
		}

		//디테일 초기화
		protected void lbtn_init_detail_Click(object sender, EventArgs e)
		{
			ClearValue();
		}

		//페이지모드변경
		protected void lbtn_chg_mode_Click(object sender, EventArgs e)
		{
			h_no.Value = "";
			lbl_pk.Text = "";
		}

		#endregion

	}
}
